package com.peaksport.framework.metadata.selector;

import java.io.Serializable;

/**
 * Select字段
 * 
 * @author jinbin_guo  2019年4月15日 下午4:49:17
 *
 */
@SuppressWarnings("serial")
public class SelectorItemInfo implements Serializable{

    /** 实体select 属性 */
    private String propertyName;
    /** 属性对应的数据库字段,含解析后的表别名*/
    private String dbField;
    /** 属性字段别名*/
    private String propertyAlias;

    public SelectorItemInfo(String propertyName)  {
        this.propertyName = propertyName;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setDbField(String dbField) {
        this.dbField = dbField;
    }

    public String getDbField() {
        return dbField;
    }

    public void setPropertyAlias(String propertyAlias) {
        this.propertyAlias = propertyAlias;
    }

    public String getPropertyAlias() {
        return propertyAlias;
    }

    public String toSQL() {
        StringBuilder sql = new StringBuilder();
        sql.append(dbField).append(" ").append(propertyAlias);
        return sql.toString();
    }

    @Override
    public String toString() {
        StringBuilder str = new StringBuilder();
        str.append("{propertyName:\"").append(propertyName).append("\",")
                .append("dbField:\"").append(dbField).append("\",")
                .append("propertyAlias:\"").append(propertyAlias).append("\"}");
        return str.toString();
    }
}
